/*
 * =====================================================================================
 *
 *       Filename:  main.cc
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  2022年01月21日 15时01分54秒
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  first_name last_name (fl), fl@my-company.com
 *        Company:  my-company
 *
 * =====================================================================================
 */

#include <thread>
#include <atomic>
#include <iostream>

using namespace std;

atomic_int a {0};
atomic_int b {0};

int ValSet(int ){
    int t = 1;
    //a = t;
    //b = 2;
    a.store(t, memory_order_relaxed);
    b.store(2, memory_order_relaxed);
}

int Observer(int) {

    cout << "(" << a <<  ", " << b  << ")" << endl;
}


int main () {

    thread t1(ValSet, 0);
    thread t2(Observer, 0 );

    t1.join();
    t2.join();

    cout << "Got (" << a <<  ", " << b  << ")" << endl;
}

